package com.tim.app.ui.activity.person_center;

import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.support.v4.view.ViewPager;
import android.view.KeyEvent;
import android.view.View;
import android.view.WindowManager;
import android.widget.ImageButton;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.application.library.util.PackageUtil;
import com.application.library.widget.smarttab.SmartTabLayout;
import com.tim.app.R;
import com.tim.app.ui.activity.BaseActivity;
import com.tim.app.ui.adapter.TabAdapter;
import com.tim.app.ui.fragment.person.MyFollowProblemFragment;
import com.tim.app.ui.fragment.person.MyFollowTopicFragment;
import com.tim.app.util.ViewGT;


/**
 * 关于页面
 */
public class AboutActivity extends BaseActivity {

    public static final String TAG = "AboutActivity";

    private ImageButton ibBack;

    private RelativeLayout rlAbout;
    private RelativeLayout rlProtocol;
    private TextView tvVersion;

    public static void start(Context context) {
        Intent intent = new Intent(context, AboutActivity.class);
        context.startActivity(intent);
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_about;
    }


    @Override
    public void initView() {
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
        getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
        ibBack = (ImageButton) findViewById(R.id.ibBack);

        rlAbout = (RelativeLayout) findViewById(R.id.rlAbout);
        rlProtocol = (RelativeLayout) findViewById(R.id.rlProtocol);

        tvVersion = (TextView) findViewById(R.id.tvVersion);
        ibBack.setOnClickListener(this);
        rlAbout.setOnClickListener(this);
        rlProtocol.setOnClickListener(this);
    }

    @Override
    public void initData() {
        String version = "V" + PackageUtil.getVersionName(this);
        tvVersion.setText(version);
    }

    @Override
    protected void onResume() {
        super.onResume();
    }


    @Override
    protected void onPause() {
        super.onPause();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        return super.onKeyDown(keyCode, event);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.ibBack://返回
                finish();
                break;
            case R.id.rlAbout:
                ViewGT.gotoGeneralWebActivity(this, "https://www.urmoli.com/webHtml/molicommunity/welcome.html", false);
                break;
            case R.id.rlProtocol:
                ViewGT.gotoGeneralWebActivity(this, "https://www.urmoli.com/app/protocol", false);
                break;
        }
    }

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
    }

}
